import React,{useEffect,useState} from 'react';
import { Popup } from 'antd-mobile'
import url from '../config/url'
import req from '../http/req'
const Pop = (props) => {
    const [username,setUsername]=useState('')
    const [mobile,setMobile]=useState('')
    const [email,setEmail]=useState('')
    const [gender,setGender]=useState('')
    const [status,setStatus]=useState('')
    useEffect(() => {
        req.get(url.DetailUserData + props.uid).then((res) => {
        setUsername(res.data.userInfo.username)
        setMobile(res.data.userInfo.mobile)
        setEmail(res.data.userInfo.email)
        setGender(res.data.userInfo.gender)
        setStatus(res.data.userInfo.status)
        console.log(res);
        
    })
    }, [])  // eslint-disable-line react-hooks/exhaustive-deps
    
    return (
        <div>
            <Popup
              visible={true}
              showCloseButton
              onClose={() => {
                props.closeDrawer()
              }}
              bodyStyle={{
                borderTopLeftRadius: '8px',
                borderTopRightRadius: '8px',
                minHeight: '20vh',
                fontSize:'20px',
                paddingLeft:'20px'
              }}
            >
              姓名：{username}<br />
              联系方式：{mobile}<br />
              邮箱：{email}<br />
              性别：{gender === '1' ? '男' : (gender === '2' ? '女' : (gender === '3' ? '保密' : ''))}<br />
              状态：{status === '1' ? '正常' : '禁用'}<br />
            </Popup>
        </div>
    );
}

export default Pop;
